package com.b2b2000.jira.plugin.projectpanel;

import com.atlassian.jira.plugin.projectpanel.fragment.ProjectTabPanelFragment;
import com.atlassian.jira.project.browse.BrowseContext;
import com.b2b2000.jira.plugin.projectpanel.AbstractFragmentBasedProjectTabPanel;
import com.b2b2000.jira.plugin.projectpanel.fragments.ProjectListIncCambFragmentImpl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

public class B2bProjectIncCambTabPanel extends AbstractFragmentBasedProjectTabPanel {
	private final com.b2b2000.jira.plugin.projectpanel.fragments.ProjectListIncCambFragmentImpl incCambFragment;
	private static final String ISSUE_TYPE_INCCAMB = new String("incidencia-camb");

	public B2bProjectIncCambTabPanel(ProjectListIncCambFragmentImpl projectListIncCambFragment) {
		incCambFragment = projectListIncCambFragment;
	}

	@Override
	protected List<ProjectTabPanelFragment> getLeftColumnFragments(BrowseContext arg0) {
		List<ProjectTabPanelFragment> fragments = new ArrayList<ProjectTabPanelFragment>();
		fragments.add(incCambFragment);
		return fragments;
	}

	@Override
	protected List<ProjectTabPanelFragment> getRightColumnFragments(BrowseContext arg0) {
		List<ProjectTabPanelFragment> fragments = new ArrayList<ProjectTabPanelFragment>();
		return fragments;
	}

	@Override
	public String createEmptyContent() {// TODO: Replicate this behaviour in the
													// other list tabs
		StringBuilder sb = new StringBuilder("<div class=\"notify error\">");
		sb.append(moduleDescriptor.getI18nBean().getText("b2b.panel.issuetype.notfound",
				StringUtils.capitalize(ISSUE_TYPE_INCCAMB)));
		sb.append("</div>");
		return sb.toString();
	}
}
